package com.dxj.controller;
import com.dxj.request.PermissionDTO;
import com.dxj.response.R;
import com.dxj.service.IPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * @author dxj
 * @Description 权限接口
 * @date 2024/7/31 16:51
 */
@RestController
@Api(tags = "权限模块")
@RequestMapping("/permission")
public class PermissionController {
    private static final Logger logger = LoggerFactory.getLogger(UserController.class);
    @Resource
    private IPermissionService permissionService;

    /**
     * 新增权限
     * @param permissionDTO
     * @return
     */
    @PostMapping("/insert")
    @ApiOperation(value = "新增权限")
    public R insert(@RequestBody @Validated PermissionDTO permissionDTO) {
        logger.info("新增角色分配权限入参:{}", permissionDTO);
        return permissionService.insertPermission(permissionDTO);
    }
}
